import router from '@system.router';
export default{
    data:{
        isOn:false,
        switchOnText:"已开启",
        switchOffText:"已关闭",
        switchOnImg:"/common/images/on.png",
        switchOffImg:"/common/images/off.png",

        value: 0,
        startValue: 0,
        currentValue: 0,
        endValue: 0,

        isDay:false,
        dayText:"白天",
        nightText:"夜间",
        dayImg:"/common/images/day.png",
        nightImg:"/common/images/night.png",

    },
    switchClick(){
        if(!this.isDay&&!this.isOn){
            var that=this;
            setTimeout(function(){
                that.value=20;
            },1000)
            setTimeout(function(){
                that.value=40;
            },2000)
            setTimeout(function(){
                that.value=60;
            },3000)
            setTimeout(function(){
                that.value=80;
            },4000)
            setTimeout(function(){
                that.value=100;
            },5000)
        }
        if(this.isDay&&!this.isOn){
            this.value=100;
        }
        this.isOn=!this.isOn;
        if(!this.isOn){
            this.value=0;
        }
    },
    patternClick(){
        this.isDay=!this.isDay;
    },
    setvalue(e) {
        if (e.mode == "start") {
            this.value = e.value;
            this.startValue = e.value;
        } else if (e.mode == "move") {
            this.value = e.value;
            this.currentValue = e.value;
        } else if (e.mode == "end") {
            this.value = e.value;
            this.endValue = e.value;
        }
    },
    timingClick(){
        router.push({
            uri:'pages/timing/timing',
        })
    }
}